<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1px">
  <caption>个人信息</caption>
  <tr>
    <td>照片</td>
    <td id="pic_td"></td>
  </tr>
  <tr>
    <td>姓名</td>
    <td id="name_td"></td>
  </tr>
  <tr>
    <td>年龄</td>
    <td id="age_td"></td>
  </tr>
  <tr>
    <td>好友</td>
    <td id="friends_td"></td>
  </tr>
</table>
<button onclick="load()">加载数据</button>
<script>
  function load() {
    let p = {name:"坤坤",age:20,url:"../2.png",friends:["小明","小东","小花"]}
    let nameTd = document.querySelector("#name_td");
    let ageTd = document.querySelector("#age_td");
    nameTd.innerText = p.name;
    ageTd.innerText = p.age;
    let picTd = document.querySelector("#pic_td");
    let img = document.createElement("img");
    img.src = p.url;
    img.width = 200;
    picTd.append(img);
    let friendsTd = document.querySelector("#friends_td");
    let ul = document.createElement("ul");
    for (let friend of p.friends) {
      let li = document.createElement("li");
      li.innerText = friend;/*依次写入数据*/
      ul.append(li);
    }
    friendsTd.append(ul);
  }
</script>
</body>
</html>